home *** CD-ROM | disk | FTP | other *** search
- # find initial file
- $file = shift(@ARGV);
-
- # set output to binary mode
- binmode(STDOUT);
-
- # parse the initial file
- parse_file($file);
-
- exit 0;
-
- # read and parse a sprite table file
- sub parse_file
- {
- local($file) = @_;
-
- print STDERR "reading $file:\n";
-
- local(@lines) = ();
-
- # open the file
- open(FILE, $file);
-
- while (<FILE>)
- {
- # read file line
- chop;
- push(@lines, $_);
- }
-
- # close the file
- close(FILE);
-
- for (@lines)
- {
- if (/^\s*\@include "(.+)"/)
- {
- # include file
- parse_file($1);
- }
- elsif (/^\s*\"(.*)\"\s+(\w+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+0x(\w+)/)
- {
- # write sprite table line
- print pack("a32a8SSSSL", $1, $2, $3, $4, $5, $6, hex($7));
- }
- }
- }
-
-